<?php
class Business_RealImage{
	
	
	

	public static function create($params){
		try {
			
			$db = Core_Global::getDatabase();
			$stmt = $db->prepare('CALL sp_insertImageEstate(:s_RealEstateID
					,:s_ImageName
					,:s_ImagePath
					,:s_Status
					,:s_ImgOrder
					,:s_CreatedDate
					,:s_CreatedBy
					,:s_UpdatedDate
					,:s_UpdatedBy)');
			foreach($params as $key=>$val){
				$stmt->bindValue('s_'.$key,$val);
			}
			$stmt->execute();
			$result = $stmt->rowCount();
			
			unset($stmt);
			
			return $result;
		} catch (Zend_Exception $e) {
			return 0;
		}
	}
	
	
	public static function deletebyImgId($ImageId){
		try {
			$db = Core_Global::getDatabase();
			$stmt = $db->prepare("CALL sp_deleteImageEstatebyImgId(:s_ImageId)");
			$stmt->bindValue('s_ImageId',$ImageId);
			$stmt->execute();
			return $stmt->rowCount();
		} catch (Zend_Exception $e) {
			return $e->getMessage();
		}
	}
	public static function deletebyRealId($RealId){
		try {
			$db = Core_Global::getDatabase();
			$stmt = $db->prepare("CALL sp_deleteImageEstatebyId(:s_RealId)");
			$stmt->bindValue('s_RealId',$RealId);
			$stmt->execute();
			return $stmt->rowCount();
		} catch (Zend_Exception $e) {
			return $e->getMessage();
		}
	}
}